<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0" />
<title>Insert title here</title>
<style>
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, p, blockquote, th, td{margin:0;padding:0;}
html{-webkit-text-size-adjust:none;}
#page_ctn{overflow:hidden;position:relative;font-size:20px;}
#pagination_ctn{position:absolute;bottom:5px;background:url('image/bg_pagination.png') no-repeat center;width:100%;height:48px;text-align:center;}
#pagination_ctn a{width:60px;height:48px;display:inline-block;vertical-align:middle;}
#pagination_ctn i{width:93px;display:inline-block;height:48px;line-height:55px;vertical-align:middle;font-size:20px;}
.loading{background:url("image/loading_b.gif") center no-repeat;}
</style>
</head>
<body>
<div id="page_ctn" class="">
	<div id="article">
<?php
require_once('include/class.php');
$dd=new data();
$type=isset($_REQUEST['type'])?$_REQUEST['type']:'get';
$a=$dd->get('book',5,array('content'));
if ($a && $a->num_rows == 1){
	$record= $a->fetch_assoc ();
	echo $record['content'];
}
?>
	</div>
	<div id="pagination_ctn"><s></s><a class="prev"></a><i></i><a class="next"></a></div>
</div>
<script type="text/javascript" src="/js/jquery-1.6.2.min.js"></script>
<script>
var a_h,c_h,page_size,page_count,page=1;
var w_h;
$(function(){
	reset_screen();go_page();
	$(window).resize(function(){reset_screen();go_page();});
	window.onorientationchange = function() {
		reset_screen();
		go_page();
	};
	$('#pagination_ctn').hover(function(){$('#pagination_ctn').stop().css('opacity',1);},hide_pagination);
	hide_pagination();
	page=$.cookie('yy_reader_page')!=null?parseInt($.cookie('yy_reader_page')):page;
	if (page>1)go_page(page);
	//$('#page_ctn').height(w_h);
	$('#pagination_ctn i').html(page+'/'+page_count);
	//$('#pagination_ctn s').html(w_w+'/'+w_h);
	$('#pagination_ctn a').click(function(){
		obj=$(this);
		if (obj.hasClass('next')){
			page++;
		}else{
			page--;
		}
		if (page>=1&&page<=page_count){
			go_page(page);
			$('#pagination_ctn i').html(page+'/'+page_count);
		}else if (page<1)
			page=1;
		else if (page>page_count)
			page=page_count;
	});
	$('#pagination_ctn').click(function(){
		$(this).fadeTo('fast',0.8);
	});
});
function reset_screen(){
	w_h=$(window).height();
	a_h=$('#article').height();
	c_h=$('#pagination_ctn').height();
	page_size=w_h-c_h;
	page_count=Math.ceil(a_h/page_size);
	if (page>page_count)
		page=page_count;
	$('#page_ctn').height(w_h);
	$('#pagination_ctn i').html(page+'/'+page_count);
}
function hide_pagination(){
	$('#pagination_ctn').stop().animate({
		opacity:0.5
	}, 1000, function() {
	    // Animation complete.
	});
}
function go_page(p){
	if (typeof p=='undefined')
		if (typeof page!='undefined')
			p=page;
		else
			p=1;
	$('#pagination_ctn').css('opacity',1);
	$.cookie('yy_reader_page',p);
	var sc_t=(p-1)*page_size;
	$('#article').stop().animate({
	    marginTop:'-'+sc_t+'px'
	}, 1000, function() {
		hide_pagination();
	});
}
jQuery.cookie = function (name, value, options) {
    if (typeof value != 'undefined') {
        options = options || {};
        if (value === null) {
            value = '';
            options = $.extend({}, options);
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString();
        }
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else {
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
</script>
</body>
</html>